#ifndef _DKGL_SCENE_H_
#define _DKGL_SCENE_H_

#include <map>
#include "dkglCamera.h"
#include "dkglColor.h"
#include "dkglSkyBox.h"
#include "dkglString.h"
#include <boost/shared_ptr.hpp>

namespace DKGL
{
    class SceneGraphVisitor
    {
    public:

        SceneGraphVisitor();

        ~SceneGraphVisitor();

        virtual void visit(const Movable&);

    };

	class Root
	{
	public:

		Root();

		~Root();

		void addChild(MovablePtr);

		void refresh();

	private:
		std::list<MovablePtr>	_movableList;


	};

	class Scene
	{
	public:
		Scene(const String&);
		~Scene();

		void refresh();
	
		//void setBackGroundColor(const Colorf&);

		//SkyBox* getSkyBox();
	
		CameraPtr createCamera(const String& name);
	
		void destroyCamera(const String& name);
	
		inline Root& getRoot()
		{
			return _root;
		}
	
		inline void enable(bool b = true)
		{_enable = b;};

	private:

		Root	_root;

		String	_name;
		bool	_enable;
		std::map<String, CameraPtr>	_cameraMap;
		
		//Colorf	m_backgroundColor;
		//SkyBox*     skybox;
	};

	typedef boost::shared_ptr<Scene> ScenePtr;

	class SceneManager// : public Singleton<SceneManeger>
	{
	public:

		SceneManager();

		~SceneManager();

		void refresh();
		
		ScenePtr createScene(const String& name);

		void destroyScene(const String& name);

		ScenePtr getScenePtr(const String& name);

		static SceneManager& instance()
		{
			static SceneManager _instance;
			return _instance;
		}

	private:

		std::map<String, ScenePtr> _sceneMap;
	};

}

#endif